/**
 * Created by 456495 on 2017/12/12.
 */

var optionsExp= {
    //Boolean - Whether we should show a stroke on each segment
    segmentShowStroke : false,

    //String - The colour of each segment stroke
    segmentStrokeColor : "#fff",

    //Number - The width of each segment stroke
    segmentStrokeWidth : 0,

    //Number - The percentage of the chart that we cut out of the middle
    percentageInnerCutout : 40, // This is 0 for Pie charts

    //Number - Amount of animation steps
    animationSteps : 100,

    //String - Animation easing effect
    animationEasing : "easeOutBounce",

    //Boolean - Whether we animate the rotation of the Doughnut
    animateRotate : true,

    //Boolean - Whether we animate scaling the Doughnut from the centre
    animateScale : false,
    showTooltips: false,
    tooltipFillColor: "rgba(255,255,255,0.8)",
    tooltipFontFamily: "'Helvetica Neue', 'Helvetica', 'Arial', sans-serif",

    // Number - Tooltip label font size in pixels
    tooltipFontSize: 12,

    // String - Tooltip font weight style
    tooltipFontStyle: "normal",

    // String - Tooltip label font colour
    tooltipFontColor: "rgb(0,0,0)",

    //String - A legend template
    // legendTemplate : "<ul class=\"<%=name.toLowerCase()%>-legend\"><% for (var i=0; i<segments.length; i++){%><li><span style=\"background-color:<%=segments[i].fillColor%>\"></span><%if(segments[i].label){%><%=segments[i].label%><%}%></li><%}%></ul>",

    responsive: true
}

var useType = '';
if(userInfo.deptCode == 'W0000017585' || userInfo.deptCode == 'W0000017577' || userInfo.deptCode == 'W0000009968' || userInfo.deptCode == 'W0000027799'){
    useType ='customer';
}else{
    useType = 'abnormal';
}

//过程异常查询        ACW_FUNCTION_00020
var processExceptionMenu = setMenuDetail("ACW_FUNCTION_00009","过程异常查询","ACW","http://acw.deppon.com/acw-web/warning/processExceptionQuery.do");
//结果异常查询      ACW_FUNCTION_00021
var resultExceptionMenu = setMenuDetail("ACW_FUNCTION_00010","结果异常查询","ACW","http://acw.deppon.com/acw-web/warning/resultExceptionQuery.do");
//指标字典        ACW_FUNCTION_00015
var dictionariesMenu = setMenuDetail("ACW_FUNCTION_00002","指标字典","ACW","http://acw.deppon.com/acw-web/warning/dictionaries.do");

/*
//过程异常查询        ACW_FUNCTION_00020
var processExceptionMenu = setMenuDetail("ACW_FUNCTION_00020","过程异常查询","ACW","http://acw.deppon.com/acw-web/warning/processExceptionQuery.do");
//结果异常查询      ACW_FUNCTION_00021
var resultExceptionMenu = setMenuDetail("ACW_FUNCTION_00021","结果异常查询","ACW","http://acw.deppon.com/acw-web/warning/resultExceptionQuery.do");
//指标字典        ACW_FUNCTION_00015
var dictionariesMenu = setMenuDetail("ACW_FUNCTION_00015","指标字典","ACW","http://acw.deppon.com/acw-web/warning/dictionaries.do");
*/

function YDException(){
    $.ajax({
        url:ACW_SERVER_NAME+"api/getReportData/"+userInfo.empCode+"/"+useType+".html",
        type:'GET',
        dataType:"json",
        success:function (dataAcw) {
            if(dataAcw.state==0) {
                $('.YDException-module').show()
                if(dataAcw.type == 'customer'){
                    $('.otherExp').show();
                    $('.YDException-module .dropdown').hide();
                    YDExpInit(isDataUndefined(dataAcw));
                }else{
                    delivExp();
                }
            }else{
                console.log("无ACW权限");
            }
        },
        error:function () {
            console.log("请求error");
        }
    })
}
function isDataUndefined(dataAcw) {
    if(dataAcw.data!='dataNull'){
        dataAcw.data.abnormalCounts = formatText(dataAcw.data.abnormalCounts);
        dataAcw.data.processingData = formatText(dataAcw.data.processingData);
        dataAcw.data.pendingData = formatText(dataAcw.data.pendingData);
        // 总数
        dataAcw.data.sumExpTodayUnsign = formatText(dataAcw.data.sumExpTodayUnsign);
        dataAcw.data.sumExpTimeoutUnsign = formatText(dataAcw.data.sumExpTimeoutUnsign);
        dataAcw.data.sumExpTimeoutUnarr = formatText(dataAcw.data.sumExpTimeoutUnarr);
        dataAcw.data.sumExpFourUnsign = formatText(dataAcw.data.sumExpFourUnsign);
        dataAcw.data.sumExpSign = formatText(dataAcw.data.sumExpSign);
        dataAcw.data.sumLostcarg = formatText(dataAcw.data.sumLostcarg);
        dataAcw.data.sumTodayMakeup = formatText(dataAcw.data.sumTodayMakeup);
        dataAcw.data.sumArrBatches = formatText(dataAcw.data.sumArrBatches);
        dataAcw.data.sumStartLate = formatText(dataAcw.data.sumStartLate);
        dataAcw.data.sumNoArrive =  formatText(dataAcw.data.sumNoArrive);
        // 处理中
        dataAcw.data.disposedExpTodayUnsign = formatText(dataAcw.data.disposedExpTodayUnsign);
        dataAcw.data.disposedExpTimeoutUnsign = formatText(dataAcw.data.disposedExpTimeoutUnsign);
        dataAcw.data.disposedExpTimeoutUnarr = formatText(dataAcw.data.disposedExpTimeoutUnarr);
        dataAcw.data.disposedExpFourUnsign = formatText(dataAcw.data.disposedExpFourUnsign);
        dataAcw.data.disposedExpSign = formatText(dataAcw.data.disposedExpSign);
        dataAcw.data.disposedLostcarg = formatText(dataAcw.data.disposedLostcarg);
        dataAcw.data.disposedTodayMakeup = formatText(dataAcw.data.disposedTodayMakeup);
        dataAcw.data.disposedNoArrive = formatText(dataAcw.data.disposedNoArrive);
        dataAcw.data.disposedStartLate = formatText(dataAcw.data.disposedStartLate);
        dataAcw.data.disposedArrBatches = formatText(dataAcw.data.disposedArrBatches);
        // 待处理
        dataAcw.data.undisposedExpTodayUnsign = formatText(dataAcw.data.undisposedExpTodayUnsign);
        dataAcw.data.undisposedExpTimeoutUnsign = formatText(dataAcw.data.undisposedExpTimeoutUnsign);
        dataAcw.data.undisposedExpTimeoutUnarr = formatText(dataAcw.data.undisposedExpTimeoutUnarr);
        dataAcw.data.undisposedExpFourUnsign = formatText(dataAcw.data.undisposedExpFourUnsign);
        dataAcw.data.undisposedExpSign = formatText(dataAcw.data.undisposedExpSign);
        dataAcw.data.undisposedLostcarg = formatText(dataAcw.data.undisposedLostcarg);
        dataAcw.data.undisposedExpTodayMakeup = formatText(dataAcw.data.undisposedExpTodayMakeup);
        dataAcw.data.undisposedArrBatches = formatText(dataAcw.data.undisposedArrBatches);
        dataAcw.data.undisposedStartLate = formatText(dataAcw.data.undisposedStartLate);
        dataAcw.data.undisposedNoArrive = formatText(dataAcw.data.undisposedNoArrive);


    }else{
        dataAcw.data={
            abnormalCounts:0,
            processingData:0,
            pendingData:0,
            // 总数
            sumExpTodayUnsign:0,
            sumExpTimeoutUnsign:0,
            sumExpTimeoutUnarr:0,
            sumExpFourUnsign:0,
            sumExpSign:0,
            sumLostcarg:0,
            sumTodayMakeup:0,
            sumArrBatches:0,
            sumStartLate:0,
            sumNoArrive:0,
            // 处理中
            disposedExpTodayUnsign:0,
            disposedExpTimeoutUnsign:0,
            disposedExpTimeoutUnarr:0,
            disposedExpFourUnsign:0,
            disposedExpSign:0,
            disposedLostcarg:0,
            disposedTodayMakeup:0,
            disposedNoArrive:0,
            disposedStartLate:0,
            disposedArrBatches:0,
            // 待处理
            undisposedExpTodayUnsign:0,
            undisposedExpTimeoutUnsign:0,
            undisposedExpTimeoutUnarr:0,
            undisposedExpFourUnsign:0,
            undisposedExpSign:0,
            undisposedLostcarg:0,
            undisposedExpTodayMakeup:0,
            undisposedArrBatches:0,
            undisposedStartLate:0,
            undisposedNoArrive:0
        }
    }
    return dataAcw
}

function delivExp() {
    var lenDeliv = $('.YDException-module .dropdown-menu li').length;
    for(var k=0;k<lenDeliv;k++){
        if($('.YDException-module .dropdown-menu li').eq(k).hasClass('active')){
            var indexDeliv = k;
        }
    }
    selectDeliv(indexDeliv);

    $('.YDException-module .dropdown .dropdown-menu>li').click(function () {
        var $inputgroupselect = "<i class='fa fa-fw fa-caret-down'></i>";
        var $precontentcss = $(this).context.textContent;
        indexDeliv = $('.YDException-module .dropdown-menu li').index(this);
        $('.YDException-module .dropdown-toggle').html($precontentcss+$inputgroupselect);
        $('.YDException-module .dropdown-menu li').removeClass("active");
        $('.YDException-module .dropdown-menu li').eq(indexDeliv).addClass("active");
        selectDeliv(indexDeliv);
    });

}
// 普通客户选择是否出发货异常页面
function selectDeliv(index) {
    $('.YDException-module').show()
    $('.YDException-module dropdown').show();
    if(index == 0){
        $('.otherExp').show();
        $('.delivExp').hide();
        // $.ajax({
        //     url:ACW_SERVER_NAME+"api/getReportData/"+userInfo.empCode+"/abnormal.html",
        //     type:'GET',
        //     dataType:"json",
        //     success:function (data) {
        //         if(data.state==0) {
        //             YDExpInit(isDataUndefined(data));
        //         }else{
        //             console.log("请求异常");
        //         }
        //     },
        //     error:function () {
        //         console.log("请求error");
        //     }
        // })

    }else{
        $('.otherExp').hide();
        $('.delivExp').show();
        $.ajax({
            url:ACW_SERVER_NAME+"api/getReportData/"+userInfo.empCode+"/ordinary.html",
            type:'GET',
            dataType:"json",
            success:function (data) {
                if(data.state==0) {
                    delivExpInit(isDataUndefined(data));
                }else{
                    console.log("请求异常");
                }
            },
            error:function () {
                console.log("请求error");
            }
        })
    }
}

// 初始化加载
function YDExpInit(dataAcw) {
    // debugger;
    var len = $('.tabException-ul li').length;
    for(var i=0;i<len;i++){
        if($('.tabException-ul li').eq(i).hasClass('active')){
            var index2 = i;
        }
    }
    selectCanvas(index2,dataAcw);

    $('.tabException-ul li').on('click',function () {
        // debugger;
        var index = $('.tabException-ul li').index(this);
        $(".YDException-module .tab-content .tab-pane").removeClass("active");
        $(".YDException-module .tab-content .tab-pane").removeClass("in");
        $(".YDException-module .tab-content .tab-pane").eq(index).addClass("active");
        $(".YDException-module .tab-content .tab-pane").eq(index).addClass("in");
        $('.tabException-ul li').removeClass("active");
        $('.tabException-ul li').eq(index).addClass("active");
        selectCanvas(index,dataAcw);
    });
}
// 出发货异常初始化
function delivExpInit(dataAcw) {
    var processExpUrl = ACW_SERVER_NAME_LINK+'acw-web/warning/processExceptionQuery.do?dept='+dataAcw.dept+'&p='+dataAcw.permissions;
    var resultExpUrl = ACW_SERVER_NAME_LINK+'acw-web/warning/resultExceptionQuery.do?dept='+dataAcw.dept+'&p='+dataAcw.permissions;
    var dataDelive=[dataAcw.data.sumTodayMakeup,dataAcw.data.sumNoArrive,dataAcw.data.sumExpTimeoutUnsign,dataAcw.data.sumExpSign,dataAcw.data.sumStartLate];
    var label = ['当天未补录','超时未到达','超时未签收','异常签收','出发晚点'];
    $("#dealException4").empty();
    var chartHtmlExp='';
    if(ergodicData(dataDelive) == 5){
        chartHtmlExp =weiBillChartHtmlNullDeliv(4,1,processExpUrl,resultExpUrl);
        YDExpSwitch('dealException4',dataDelive,0,chartHtmlExp,0);
    }else{
        chartHtmlExp = weiBillChartHtmlDeliv(4,1,processExpUrl,resultExpUrl);
        // debugger;
        YDExpSwitch('dealException4',dataDelive,4,chartHtmlExp,label);
    }
}
// 选择图表
function selectCanvas(index,dataAcw) {
    var processExpUrl = ACW_SERVER_NAME_LINK+'acw-web/warning/processExceptionQuery.do?dept='+dataAcw.dept+'&p='+dataAcw.permissions;
    var resultExpUrl = ACW_SERVER_NAME_LINK+'acw-web/warning/resultExceptionQuery.do?dept='+dataAcw.dept+'&p='+dataAcw.permissions;
    $("#dealException0").empty();
    $("#dealException1").empty();
    $("#dealException2").empty();
    $('.tabException-ul li').eq(0).find('span').html(dataAcw.data.abnormalCounts);
    $('.tabException-ul li').eq(1).find('span').html(dataAcw.data.processingData);
    $('.tabException-ul li').eq(2).find('span').html(dataAcw.data.pendingData);
    var labelShow='';
    if(dataAcw.type == 'customer'){
        var data0 = [dataAcw.data.sumExpTodayUnsign,dataAcw.data.sumExpTimeoutUnsign,dataAcw.data.sumExpTimeoutUnarr,dataAcw.data.sumExpFourUnsign];
        var data1 = [dataAcw.data.disposedExpTodayUnsign,dataAcw.data.disposedExpTimeoutUnsign,dataAcw.data.disposedExpTimeoutUnarr,dataAcw.data.disposedExpFourUnsign];
        var data2 = [dataAcw.data.undisposedExpTodayUnsign,dataAcw.data.undisposedExpTimeoutUnsign,dataAcw.data.undisposedExpTimeoutUnarr,dataAcw.data.undisposedExpFourUnsign];
        labelShow = ['当天未签收','超时未签收','超时未到达','4小时以上未签收'];
    }else{
        var data0 = [dataAcw.data.sumExpTimeoutUnsign,dataAcw.data.sumTodayMakeup,dataAcw.data.sumExpSign,dataAcw.data.sumArrBatches,dataAcw.data.sumLostcarg];
        var data1 = [dataAcw.data.disposedExpTimeoutUnsign,dataAcw.data.disposedTodayMakeup,dataAcw.data.disposedExpSign,dataAcw.data.disposedArrBatches,dataAcw.data.disposedLostcarg];
        var data2 = [dataAcw.data.undisposedExpTimeoutUnsign,dataAcw.data.undisposedExpTodayMakeup,dataAcw.data.undisposedExpSign,dataAcw.data.undisposedArrBatches,dataAcw.data.undisposedLostcarg];
        labelShow = ['超时未签收','当天未补录','异常签收','分批到达','丢货'];
    }
    if(index==0){
        selectHtml(index,data0,processExpUrl,resultExpUrl,labelShow);
    }
    if(index == 1){
        selectHtml(index,data1,processExpUrl,resultExpUrl,labelShow);
    }
    if(index == 2) {
        selectHtml(index,data2,processExpUrl,resultExpUrl,labelShow);
    }


}

// 选择大客户html
function selectHtml(index,data,processExpUrl,resultExpUrl,label) {
    var chartHtmlExp='';
    var isStr='dealException'+index;
    if(useType == 'customer'){
        if(ergodicData(data) == 4){
            chartHtmlExp =weiBillChartHtmlNullD(index,index+1,processExpUrl,resultExpUrl);
            YDExpSwitch(isStr,data,0,chartHtmlExp,0);
        }else{
            chartHtmlExp = weiBillChartHtmlD(index,index+1,processExpUrl,resultExpUrl);
            YDExpSwitch(isStr,data,index,chartHtmlExp,label);
        }

    }else{
        if(ergodicData(data) == 5){
            chartHtmlExp =weiBillChartHtmlNull(index,index+1,processExpUrl,resultExpUrl);
            YDExpSwitch(isStr,data,0,chartHtmlExp,0);
        }else{
            chartHtmlExp = weiBillChartHtml(index,index+1,processExpUrl,resultExpUrl);
            YDExpSwitch(isStr,data,index,chartHtmlExp,label);
        }
    }
}

// 普通客户标签
function chartHtmlNeed(pram,processExpUrl,resultExpUrl){
    var chartHtmlLi =
        '<li onclick="viewTab(\'结果异常查询\',\''+resultExpUrl+'&ex=1'+'&queryType='+pram+'\',\'iframe\',null,resultExceptionMenu)"><div>超时未签收</div><div>{A}</div></li>'+
        '<li onclick="viewTab(\'过程异常查询\',\''+processExpUrl+'&ex=6'+'&queryType='+pram+'\',\'iframe\',null,processExceptionMenu)"><div>当天未补录</div><div>{B}</div></li>'+
        '<li onclick="viewTab(\'过程异常查询\',\''+processExpUrl+'&ex=5'+'&queryType='+pram+'\',\'iframe\',null,processExceptionMenu)"><div>异常签收</div><div>{C}</div></li>'+
        '<li onclick="viewTab(\'过程异常查询\',\''+processExpUrl+'&ex=10'+'&queryType='+pram+'\',\'iframe\',null,processExceptionMenu)"><div>分批到达</div><div>{D}</div></li>'+
        '<li onclick="viewTab(\'过程异常查询\',\''+processExpUrl+'&ex=12'+'&queryType='+pram+'\',\'iframe\',null,processExceptionMenu)"><div>丢货</div><div>{E}</div></li>';

    return chartHtmlLi
}

//出发货异常便签
function chartHtmlDeliv(pram,processExpUrl,resultExpUrl) {
    var chartHtmlLi =
        '<li onclick="viewTab(\'过程异常查询\',\''+processExpUrl+'&ex=6'+'&queryType='+pram+'\',\'iframe\',null,processExceptionMenu)"><div>当天未补录</div><div>{A}</div></li>'+
        '<li onclick="viewTab(\'结果异常查询\',\''+resultExpUrl+'&ex=3'+'&queryType='+pram+'\',\'iframe\',null,resultExceptionMenu)"><div>超时未到达</div><div>{B}</div></li>'+
        '<li onclick="viewTab(\'结果异常查询\',\''+resultExpUrl+'&ex=1'+'&queryType='+pram+'\',\'iframe\',null,resultExceptionMenu)"><div>超时未签收</div><div>{C}</div></li>'+
        '<li onclick="viewTab(\'过程异常查询\',\''+processExpUrl+'&ex=5'+'&queryType='+pram+'\',\'iframe\',null,processExceptionMenu)"><div>异常签收</div><div>{D}</div></li>'+
        '<li onclick="viewTab(\'过程异常查询\',\''+processExpUrl+'&ex=2'+'&queryType='+pram+'\',\'iframe\',null,processExceptionMenu)"><div>出发晚点</div><div>{E}</div></li>';

    return chartHtmlLi
}

// 大客户便签
function chartHtmlD(pram,processExpUrl,resultExpUrl) {
    var chartHtmlLiD =
        '<li onclick="viewTab(\'结果异常查询\',\''+resultExpUrl+'&ex=2'+'&queryType='+pram+'\',\'iframe\',null,resultExceptionMenu)"><div>当天未签收</div><div>{A}</div></li>'+
        '<li onclick="viewTab(\'结果异常查询\',\''+resultExpUrl+'&ex=1'+'&queryType='+pram+'\',\'iframe\',null,resultExceptionMenu)"><div>超时未签收</div><div>{B}</div></li>'+
        '<li onclick="viewTab(\'结果异常查询\',\''+resultExpUrl+'&ex=3'+'&queryType='+pram+'\',\'iframe\',null,resultExceptionMenu)"><div>超时未到达</div><div>{C}</div></li>'+
        '<li onclick="viewTab(\'结果异常查询\',\''+resultExpUrl+'&ex=4'+'&queryType='+pram+'\',\'iframe\',null,resultExceptionMenu)"><div>4小时以上未签收</div><div>{D}</div></li>'

    return chartHtmlLiD
}

// 普通客户需处理图表html时
function weiBillChartHtml(index,pram,processExpUrl,resultExpUrl) {
    var chartHtmlli = chartHtmlNeed(pram,processExpUrl,resultExpUrl);
    var weiBillChartHtml = ' <div class="YDExceptionS">'+
        '<div class="canvas-box">'+
        '<canvas id="YDExcption'+index+'" style="width:80px; height: 80px;margin: 0;position: absolute;top: -10px;"></canvas>'+
        '</div>'+
        '</div>'+
        '<div class="Exception-listS">'+
        '<ul class="Exception-list-ul">'+ chartHtmlli+ '</ul>'+
        '</div>';
    return weiBillChartHtml
}

function weiBillChartHtmlDeliv(index,pram,processExpUrl,resultExpUrl) {
    var chartHtmlli=chartHtmlDeliv(pram,processExpUrl,resultExpUrl);
    var weiBillChartHtml = ' <div class="YDExceptionS">'+
        '<div class="canvas-box">'+
        '<canvas id="YDExcption'+index+'" style="width:80px; height: 80px;margin: 0 ;position: absolute;top: -10px;"></canvas>'+
        '</div>'+
        '</div>'+
        '<div class="Exception-listS">'+
        '<ul class="Exception-list-ul">'+ chartHtmlli+ '</ul>'+
        '</div>';
    return weiBillChartHtml
}

// 大客户有图表html时
function weiBillChartHtmlD(index,pram,processExpUrl,resultExpUrl) {
    var chartHtmlLiD=chartHtmlD(pram,processExpUrl,resultExpUrl);
    var weiBillChartHtmlD = ' <div class="YDException">'+
        '<div class="canvas-box">'+
        '<canvas id="YDExcption'+index+'" style="width:80px; height: 80px;margin: 0 "></canvas>'+
        '</div>'+
        '</div>'+
        '<div class="Exception-list">'+
        '<ul class="Exception-list-ul">'+ chartHtmlLiD+ '</ul>'+
        '</div>'
    return weiBillChartHtmlD
}

// 普通员工为空时html
function weiBillChartHtmlNull(index,pram,processExpUrl,resultExpUrl) {
    var chartHtmlLi=chartHtmlNeed(pram,processExpUrl,resultExpUrl);
    var nullChartHtml = ' <div class="YDExceptionNull col-md-5">'+
        '<div id="YDExcption'+index+'" style="width:81px; height: 81px;margin: 0 ;line-height: 85px"><img src="resources/img/chart_exp_null.png"/></div>'+
        '</div>'+
        '<div class="Exception-listNull col-md-7">'+
        '<ul class="Exception-list-ul">'+
        chartHtmlLi+
        '</ul>'+
        '</div>'

    return nullChartHtml;
}

function weiBillChartHtmlNullDeliv(index,pram,processExpUrl,resultExpUrl) {
    var chartHtmlLi=chartHtmlDeliv(pram,processExpUrl,resultExpUrl);
    var nullChartHtml = ' <div class="YDExceptionNull col-md-5">'+
        '<div id="YDExcption'+index+'" style="width:81px; height: 81px;margin: 0 ;line-height: 85px"><img src="resources/img/chart_exp_null.png"/></div>'+
        '</div>'+
        '<div class="Exception-listNull col-md-7">'+
        '<ul class="Exception-list-ul">'+
        chartHtmlLi+
        '</ul>'+
        '</div>'

    return nullChartHtml;
}
// 大客户为空时html
function weiBillChartHtmlNullD(index,pram,processExpUrl,resultExpUrl) {
    var chartHtmlLiD=chartHtmlD(pram,processExpUrl,resultExpUrl);
    var nullChartHtmlD = ' <div class="YDExceptionNull col-md-5">'+
        '<div id="YDExcption'+index+'" style="width:81px; height: 81px;margin: 0"><img src="resources/img/chart_exp_null.png"/></div>'+
        '</div>'+
        '<div class="Exception-listNull col-md-7">'+
        '<ul class="Exception-list-ul">'+
        chartHtmlLiD+
        '</ul>'+
        '</div>'

    return nullChartHtmlD;
}

// 数据是否都为零
function ergodicData(data) {
    var flag_index = 0;
    for(var j=0;j<data.length;j++){
        if(data[j] == 0){
            flag_index=flag_index+1;
        }
    }
    return flag_index
}

// 加载图表设置
function YDExpSwitch(idnum,dataNum,indexNum,YDChartHtml,labelShow){


    var YDobj=YDChartHtml.replace("{A}",dataNum[0]).replace("{B}",dataNum[1]).replace("{C}",dataNum[2]).replace("{D}",dataNum[3]);
    if(labelShow != 0){
        var data = [

            {
                value: dataNum[0],
                color: "#ffc67f",
                label: labelShow[0]
            },
            {
                value: dataNum[1],
                color: "#9acffb",
                label: labelShow[1]
            },
            {
                value: dataNum[2],
                color: "#c7cff4",
                label: labelShow[2]
            },
            {
                value: dataNum[3],
                color:"#7cbdf7",
                label: labelShow[3]
            }
        ]
        if(useType != 'customer'){
            YDobj =YDChartHtml.replace("{A}",dataNum[0]).replace("{B}",dataNum[1]).replace("{C}",dataNum[2]).replace("{D}",dataNum[3]).replace("{E}",dataNum[4]);
            data[4]={value: dataNum[4],
                color:"#c7bff9",
                label: labelShow[4]}
        }
    }else{
        if(useType != 'customer'){
            YDobj =YDChartHtml.replace("{A}",dataNum[0]).replace("{B}",dataNum[1]).replace("{C}",dataNum[2]).replace("{D}",dataNum[3]).replace("{E}",dataNum[4]);
        }
    }

    $('#'+idnum+'').append(YDobj);
    if(labelShow != 0){
        var areaChart = new Chart($('#YDExcption'+indexNum).get(0).getContext("2d"));
        areaChart.Doughnut(data,optionsExp);
    }
}
// 查看全部
function wayBillExpAll() {
    var IndexDicUrl = ACW_SERVER_NAME_LINK+'acw-web/warning/dictionaries.do';
    viewTab("指标字典",IndexDicUrl,'iframe',null,dictionariesMenu);
}


